<!DOCTYPE html>

<html>
<head>
    {% include 'style.html' %}
</head>

<body>
<form action="{% url 'users:logout' %}" method="post" id="logout_form">
    {% csrf_token %}
</form>

<script>
	function logout() {
		let form = document.getElementById('logout_form');
		form.submit();
	}
</script>

<ul class="navigation_bar">
    <li><a href="{% url 'chat:index' %}">主页</a></li>
    {% if user.is_authenticated %}
    <li><a href="javascript:logout()">登出</a></li>
    {% else %}
    <li><a href="{% url 'users:login' %}">登录</a></li>
    {% endif %}
    <li><a href="{% url 'chat:search_group' %}">搜索</a></li>
    <li><a href="{% url 'chat:create_group' %}">新建</a></li>
    {% if user.is_authenticated %}
    <li class="navigation_bar_right"><span style="color: #c6f2ff">你好，{{user.username}}！</span></li>
    {% endif %}
</ul>

{% block content %}
{% endblock content %}
</body>
</html>
